package com.rjwh.dingdong.client.mvp.model.impl;

import com.aishua.lib.task.AsResult;
import com.rjwh.dingdong.client.application.MyApplication;
import com.rjwh.dingdong.client.constant.LocalConstant;
import com.rjwh.dingdong.client.constant.NetConstant;
import com.rjwh.dingdong.client.mvp.BaseModel;
import com.rjwh.dingdong.client.mvp.BasePresenter;
import com.rjwh.dingdong.client.mvp.model.ICommunityModel;
import com.rjwh.dingdong.client.network.HttpWebService;
import com.rjwh.dingdong.client.network.HttpWebServiceCallBack;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Kay on 2016-6-27.
 */
public class CommunityModel extends BaseModel implements ICommunityModel, HttpWebServiceCallBack {


    public CommunityModel(BasePresenter basePresenter) {
        super(basePresenter);
    }

    /**
     * 获取社区模块列表
     */
    @Override
    public void doGetModularList() {
        Map<String, String> getModularListParams = new HashMap<String, String>();
        getModularListParams.put("userid", MyApplication.spUtil.getStrPreferenceByParamName(MyApplication.app, LocalConstant.SP_USERID));
        HttpWebService.getDataFromServer(NetConstant.COMMUNITY_GETMODULARLIST, getModularListParams, true, this);
    }

    @Override
    public void onServerDataAcquired(int businessType, AsResult mAsResult, boolean isRefresh) {
        if(getBasePresenter()!= null)getBasePresenter().onServerDataAcquired(businessType, mAsResult, isRefresh);
    }
}
